<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="javabean.UserBean"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link href="../../CSS/Site1.css" type="text/css" rel="stylesheet"/>

    </head>
    <body background="/DeAn_WebTruyen/Images/happy_christmas_holidays-1280x1024.jpg">
        <div class="container">
            <div class="header">
                <div class="header_top_left">
                    <%
                        Date d = new Date();
                        DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyyy");

                        out.print(dateFormat.format(d));
                    %>
                </div>
                <div class="header_top_right">  
                    <%
                        UserBean user = (UserBean) session.getAttribute("userbean");
                        if (user.getUsername() != "") {
                            String username = user.getUsername();
                            out.print("Hello : " + username);
                        }
                    %> 
                    <br/>
                    <a href="/DeAn_WebTruyen/Home.jsp">Log out</a>
                       
                </div>
                <%--<div class="clear"></div>--%>

                <div class="clear"></div>             

                <div class="header_main" > 
                    <script type="text/javascript">
        
                        var img1="12855184861024648803.jpg"
                        var img2="12855185051828767054.jpg"
                        var img3="1285518514197142706.jpg"
                        var img4="1285518527375730281.jpg"
                        var img5="1285518537601341394.jpg"

                        var cur=Math.round(5*Math.random())
                        if (cur<=1)
                        {
                            img=img1
                        }
                        else if (cur<=2)
                        {
                            img=img2
                        }
                        else if (cur<=3)
                        {
                            img=img3
                        }
                        else if (cur<=4)
                        {
                            img=img4
                        }        
                        else
                            img=img5
                        document.write('<div class="header_main" > <img src="../../Images/'+img+'"/></div>')
              
        
                    </script>
                </div>
               
            </div>


          
            <%
                UserBean user1 = (UserBean) session.getAttribute("userbean");
                if (user1 == null || !user.getRole().equals("admin")) {
                    response.sendRedirect("./Login.jsp");
                }
            %>
            <form action="" style="text-align: center; " method="POST">
                <h1 >Admin Functions</h1>
                <div style="font-size: larger;">
                <a href="CreateUser.jsp">Create a new user</a><br>
                <a href="SearchUsers.jsp">Search user</a><br>
                <a href="/DeAn_WebTruyen/ListUsersServlet">List users</a><br>
                <a href="/DeAn_WebTruyen/ListAllStories">List stories</a>
                
                </div>
                
            </form>
        
               <div style=" background-image:url(/DeAn_WebTruyen/Images/footer_bg2.jpg) ; color: #FF0000;">
                <p >
                    © Copyright . All right reserved
                    <br />
                    Email: <a href="mailto:maiphuong0403@Gmail.com"><img src="/DeAn_WebTruyen/Images/gmail-icon.gif">MaiPhuong0403@Gmail.com</a>
                <ul style="text-align: center">
                    Power by<img src="/DeAn_WebTruyen/Images/Untitled.png" />
                </ul>
                </p>

            </div>
    </div>
    </body>
</html>
